Entry: Fix leak of text in ensure_has_tooltip()
authorDaniel Boles <dboles@src.gnome.org>
Thu, 7 Sep 2017 13:53:59 +0000 (14:53 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Thu, 7 Sep 2017 13:56:20 +0000 (14:56 +0100)
Thanks to Mohammed Sadiq for noticing this. I guess I got
Widget.get_tooltip_text() confused with Label.get_label().

https://bugzilla.gnome.org/show_bug.cgi?id=787410

gtk/gtkentry.c

index e2f22dc281b7bc8f3b55ab77576ca9d9419c7de4..7c5673c5eed909fd505c8ec11a512a09312fb079 100644 (file)
@@ -8127,7 +8127,8 @@ gtk_entry_get_icon_area (GtkEntry             *entry,
 static void
 ensure_has_tooltip (GtkEntry *entry)
 {
-  gboolean has_tooltip = gtk_widget_get_tooltip_text (GTK_WIDGET (entry)) != NULL;
+  gchar *text = gtk_widget_get_tooltip_text (GTK_WIDGET (entry));
+  gboolean has_tooltip = text != NULL;
 
   if (!has_tooltip)
     {
@@ -8145,6 +8146,10 @@ ensure_has_tooltip (GtkEntry *entry)
             }
         }
     }
+  else
+    {
+      g_free (text);
+    }
 
   gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
 }